-- Key binds -- 
local opts = { noremap = true, silent = true }
local keymap = vim.api.nvim_set_keymap

-- set no hightlight
vim.api.nvim_set_keymap('n', '<Esc>',':nohl<CR>',{noremap=true, silent=true})

-- Modes 
--      normal_mode = 'n'
--      insert_mode = 'i'
--      visual_mode = 'v'
--      visual_block_mode = 'x'
--      term_mode = 't'
--      command_mode = 'c'

-- Normal -- 
-- Better window navigation
keymap("n", "<C-h>", "<C-w>h", opts)
keymap("n", "<C-j>", "<C-w>j", opts)
keymap("n", "<C-k>", "<C-w>k", opts)
keymap("n", "<C-l>", "<C-w>l", opts)

-- line moving
keymap("n", "<A-h>", ":bp<CR>", opts)
keymap("n", "<A-l>", ":bn<CR>", opts)

-- buffer navigation: S - Shift  <CR> - character return (Enter)
keymap("n", "H", ":bprevious<CR>", opts)
keymap("n", "L", ":bnext<CR>",opts)
-- Visual Mode -- 
-- keep in retract mode  
keymap("v", "<", "<gv", opts)
keymap("v", ">", ">gv", opts)

-- move text up and down 
keymap("v", "<A-j>", ":m .+1<CR>==", opts)
keymap("v", "<A-k>", ":m .-1<CR>==", opts)

-- adjust nvim-tree width
keymap("n", "<A-w>", ":lua require('nvim-tree.api').tree.resize('+5')<CR>", opts)
keymap("n", "<A-q>", ":lua require('nvim-tree.api').tree.resize('-5')<CR>", opts)
